
$(function(){	
				//点击右边nav跳转购物车
				$('#cart').click(function(){
					window.location.href="cart.html";
					console.log('gg')
				});
				//轮播图的启用  引用了插件
				$('.carousel').carousel({
					interval: 3000,
					pause:'hover',//鼠标进入时暂停轮播循环，鼠标离开时恢复轮播循环。
					warp:true //轮播是否连续循环
				});
				//导入脚部
				$('#footer0').load('foot.html')
				
				$('#nav-r').css({		
					width:'40px',
					height:$(window).height(),
					color:'red',										
					background:'black',
					 position:'fixed',
					  right:'10px',
					  opacity:0.4,
					  zIndex:3					 
				});
				$('#list').css(
					{width:'40px',
					height:$(window).height(),																			
					 position:'fixed',
					  right:'10px',					 
					  zIndex:4,
					 textAlign: 'center'									 
					}
				);
				//右导航
				$('#list-up>li,#list-down>li').find('div').hide();
				$('#list-up>li,#list-down>li').mouseenter(function(){
					//console.log($(this).index())
					$(this).css({background:'#ff5072'}).siblings().css({background:'#999999'})
					$(this).find('div').show().closest('li').siblings().find('div').hide();
					//$(this).find('div').show().animate({right:100},600).closest('li').siblings().find('div').hide();
				});
				$('#list-up>li,#list-down>li').mouseleave(function(){
					$(this).css({background:'#999999'})
					$('#list-up>li,#list-down>li').find('div').hide();
				});				
				$('li:last').click(function(){
						//console.log('aa')
						$(window).scrollTop(0);
				});
				
				$('#gotop').click(function(){
						console.log('aa')
						$(window).scrollTop(0);
				});
				
				$('#good-list li div').hide();
				//console.log(count)
				
				//商品列表
				
				$('#good-list>li').mouseenter(function(){
					console.log($(this).index())
					$(this).find('a').css({color:'#ff5072'})
					$(this).find('div').show()
					//$(this).find('div').animate({left:20},600)
				});
				$('#good-list li').mouseleave(function(){
					$(this).find('a').css('color','white')
					$(this).find('div').hide()
				});
				
				//点击加入购物车按钮   效果只做了前面几个
				//var aa = $('#china input').length;
				//console.log(aa)
				var gname;
				var gprice;
				var num;
				var arrw = [];
				$('#china input').click(function(){
					console.log('ok')
					//点击购物车商品数量加1					
					num = parseInt($('#cart span').text())
					num +=1
					$('#cart span').text(num)
										
					gname = $(this).closest('dl').find('dd.PE').find('span').text();
					gprice = $(this).closest('dl').find('dd.price').find('span').text();
					
					arrw.push(gname);
					arrw.push(gprice)
					
					//取出商品名
					//console.log($(this).closest('dl').find('dd.PE').find('span').text());															
					//取出现卖价钱
					//console.log($(this).closest('dl').find('dd.price').find('span').text());
					
					//将相对应的商品名和价格存到jq.cookie里
					if($.cookie(gname)==null){						
					    var sname = {gname:gname,gprice:gprice};
					    var arrs = JSON.stringify(sname);
					    $.cookie(gname,arrs,{path: "/", expires: 7 })
					    console.log('商品已加入');//$.cookie(gname,null);
					    alert("商品已加入购物车里")
					
					}else{
						//console.log('商品已存在');
						alert("商品已存在购物车里")
						//var strl = $.cookie(gname); 
			       		//var o1 = JSON.parse(strl);　
						//console.log(o1.gname);
						//console.log(o1.gprice);

					}
					
				});
		
})
